﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 9/1/2009
 * Time: 9:34 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using Buaya.Model.Dao;
using System.Collections.Generic;
using System.Data;

namespace Buaya.Model
{
	/// <summary>
	/// Description of SessionFacade.
	/// </summary>
	public class SessionFacade
	{
		public SessionFacade()
		{
		}
		
		public static void SaveOrUpdateDeduction(Deduction d)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDeductionDao().SaveOrUpdate(d);
		}
		
		public static void SaveOrUpdateLoan(Loan l)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateLoanDao().SaveOrUpdate(l);
		}
		
		public static void SaveOrUpdatePayslip(Payslip p)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePayslipDao().SaveOrUpdate(p);
		}
		
		public static void SaveOrUpdateModule(Module m)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateModuleDao().SaveOrUpdate(m);
		}
		
		public static void SaveOrUpdateBank(Bank b)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateBankDao().SaveOrUpdate(b);
		}
		
		public static void SaveOrUpdateShift(Shift s)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateShiftDao().SaveOrUpdate(s);
		}
		
		public static void SaveOrUpdateWorkersCompensation(WorkersCompensation c)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateWorkersCompensationDao().SaveOrUpdate(c);
		}
		
		public static void SaveOrUpdateTaxCode(TaxCode t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateTaxCodeDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdatePagIbigPremium(PagIbigPremium p)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePagIbigPremiumDao().SaveOrUpdate(p);
		}
		
		public static void SaveOrUpdatePayrollCode(PayrollCode c)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePayrollCodeDao().SaveOrUpdate(c);
		}
		
		public static void SaveOrUpdateTimesheet(Timesheet t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateTimesheetDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdatePhilhealthPremium(PhilhealthPremium p)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePhilhealthPremiumDao().SaveOrUpdate(p);
		}
		
		public static void SaveOrUpdateSSSPremium(SSSPremium p)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateSSSPremiumDao().SaveOrUpdate(p);
		}
		
		public static void SaveOrUpdateDeductionType(DeductionType t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDeductionTypeDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdateLoanType(LoanType t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateLoanTypeDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdateEmployeeType(EmployeeType t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateEmployeeTypeDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdateToDo(ToDo t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateToDoDao().SaveOrUpdate(t);
		}
		
		public static void SaveOrUpdateCompany(Company c)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateCompanyDao().SaveOrUpdate(c);
		}
		
		public static void SaveOrUpdateUser(User u)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateUserDao().SaveOrUpdate(u);
		}
		
		public static void SaveOrUpdateDepartment(Department d)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDepartmentDao().SaveOrUpdate(d);
		}
		
		public static void SaveOrUpdateEmployee(Employee e)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateEmployeeDao().SaveOrUpdate(e);
		}
		
		public static void SaveOrUpdatePosition(Position p)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePositionDao().SaveOrUpdate(p);
		}
		
		public static void DeleteUser(User u)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateUserDao().Delete(u);
		}
		
		public static void DeleteDeductionType(DeductionType t)
		{
			DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDeductionTypeDao().Delete(t);
		}
		
		public static Employee ReadEmployeeById(string id)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateEmployeeDao().ReadById(id);
		}
		
		public static Module ReadModuleByPk(int id)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateModuleDao().ReadByPk(id);
		}
		
		public static Company ReadCompanyByPk(int id)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateCompanyDao().ReadByPk(id);
		}
		
		public static User ReadUserByNameAndPassword(string name, string password)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateUserDao().ReadByNameAndPassword(name, password);
		}
		
		public static IList<ToDo> FindAllToDos()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateToDoDao().FindAll();
		}
		
		public static IList<Timesheet> FindTimesheetsByDate(DateTime from, DateTime to)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateTimesheetDao().FindByDate(from, to);
		}
		
		public static IList<Deduction> FindDeductionsByEmployeeAndPayrollCode(Employee e, PayrollCode p)
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDeductionDao().FindByEmployeeAndPayrollCode(e, p);
		}
		
		public static IList<Bank> FindAllBanks()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateBankDao().FindAll();
		}
		
		public static IList<Module> FindAllModules()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateModuleDao().FindAll();
		}
		
		public static IList<Shift> FindAllShifts()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateShiftDao().FindAll();
		}
		
		public static IList<TaxCode> FindAllTaxCodes()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateTaxCodeDao().FindAll();
		}
		
		public static IList<PayrollCode> FindAllPayrollCodes()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePayrollCodeDao().FindAll();
		}
		
		public static IList<PagIbigPremium> FindAllPagIbigPremiums()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePagIbigPremiumDao().FindAll();
		}
		
		public static IList<PhilhealthPremium> FindAllPhilhealthPremiums()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePhilhealthPremiumDao().FindAll();
		}
		
		public static IList<SSSPremium> FindAllSSSPremiums()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateSSSPremiumDao().FindAll();
		}
		
		public static IList<WorkersCompensation> FindAllWorkersCompensations()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateWorkersCompensationDao().FindAll();
		}
		
		public static IList<Employee> FindAllEmployees()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateEmployeeDao().FindAll();
		}
		
		public static IList<DeductionType> FindAllDeductionTypes()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDeductionTypeDao().FindAll();
		}
		
		public static IList<User> FindAllUsers()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateUserDao().FindAll();
		}
		
		public static IList<EmployeeType> FindAllEmployeeTypes()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateEmployeeTypeDao().FindAll();
		}
		
		public static IList<Department> FindAllDepartments()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateDepartmentDao().FindAll();
		}
		
		public static IList<Position> FindAllPositions()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreatePositionDao().FindAll();
		}
		
		public static IList<LoanType> FindAllLoanTypes()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.NHIBERNATE).CreateLoanTypeDao().FindAll();
		}
		
		public static DataSet FindAllEmployeesDS()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.ACCESS).CreateEmployeeDao().FindAllDS();
		}
		
		public static DataSet FindAllDepartmentsDS()
		{
			return DaoFactory.GetDaoFactory(DaoFactory.ACCESS).CreateDepartmentDao().FindAllDS();
		}
	}
}
